//
// Created by Administrator on 2021/10/13.
//

#ifndef MRENDER_HELLOEXCEPTION_H
#define MRENDER_HELLOEXCEPTION_H

// TODO 1. 程序异常堆栈打印

class MBaseException : public std::exception{
private:
    std::string cause;
public:
    MBaseException(const std::string& filename, int line, const char* ex) {
        cause = filename + " @" + std::to_string(line) + " - [" + ex + "]";
    }

    MBaseException(const std::string& filename, int line, const char* ex, const char* msg) {
        cause = filename + " @" + std::to_string(line) + " - [" + ex + "]: " + msg;
    }

    const char * what() const noexcept override {
        return cause.c_str();
    }
};

#endif //MRENDER_HELLOEXCEPTION_H
